package com.example.comment_oa.aspact;

import com.example.comment_oa.response.AjaxResponse;
import com.example.comment_oa.response.CustomError;
import com.example.comment_oa.response.CustomErrorType;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class Globaexception {
    @ExceptionHandler(value = MyException.class)
    public AjaxResponse handler(MyException e) {
        System.out.println("无权限！");
        return AjaxResponse.error(new CustomError(CustomErrorType.Authorization, "12345"));
    }
}
